package com.aivin.lib_media.myMp3Player;


public class Mp3PlayerTool  {
    private MediaPlayerHolder mediaPlayerIngHolder  ;

    public Mp3PlayerTool( String filePath ,PlaybackInfoListener playbackInfoListener){
        mediaPlayerIngHolder = new MediaPlayerHolder();
        mediaPlayerIngHolder.setmPlaybackInfoListener(playbackInfoListener);
        mediaPlayerIngHolder.loadMedia(filePath);
    }

    public void seekToByPercent(int progress){
        if(mediaPlayerIngHolder!=null){
            mediaPlayerIngHolder.seekToByPercent(progress);
        }
    }

    public boolean isPlaying() {
        if (mediaPlayerIngHolder != null) {
            return mediaPlayerIngHolder.isPlaying();
        }
        return false;
    }

    public void play(){
        if(mediaPlayerIngHolder!=null){
            mediaPlayerIngHolder.play();
        }
    }

    public void pause(){
        if(mediaPlayerIngHolder!=null){
            mediaPlayerIngHolder.pause();
        }
    }

    public void release(){
        if(mediaPlayerIngHolder!=null){
            mediaPlayerIngHolder.release();
            mediaPlayerIngHolder = null;
        }
    }
}
